[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
if                       Signals the Start of an IF/THEN/ELSE Statement

 if <bool exp> then
   <statement>;

 if <bool exp> then
   <statement1>
 else
   <statement2>;

    If <bool exp> yields a value of TRUE, then <statement> is executed. In
    the IF/THEN/ELSE form, if <bool exp> is TRUE, then <statement1> is
    executed; otherwise, <statement2> is executed. Note that these are
    single statements; if you want multiple statements, you must use a
    compound statement instead, such as:

         if <bool exp> then begin
           <statement>;
           ...;
           <statement>
         end;


      <bool exp>    A Boolean expression yielding a value of TRUE or
                    FALSE.
    <statement>,
    <statement1>
    <statement2>    Any legal statement, including a compound statement.

  -------------------------------- Example ---------------------------------

           if B = 0
             then Writeln('Ratio is undefined')
             else Writeln('Ratio is ',A/B);

See Also: then else begin end
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson